//
//  FourGViewController.m
//  DaJiHui
//
//  Created by Hao on 2017/6/26.
//  Copyright © 2017年 Hao. All rights reserved.
//
#import "FJFViewController.h"
#import "FXXViewController.h"
#import "FHBViewController.h"
#import "FTBViewController.h"
#import "FSPViewController.h"
#import "FZHViewController.h"
#import "FKFViewController.h"
#import "FWMViewController.h"
#import "FourTableViewCell.h"
#import "UIColor+methods.h"
#import "FourGViewController.h"
#import "SMS_Scroll_ImageView.h"
@interface FourGViewController ()<UITableViewDelegate, UITableViewDataSource>
@property(nonatomic, strong)UITableView *myTableView;
@property(nonatomic, strong)NSMutableArray *marr;
@property(nonatomic, strong)NSMutableArray *marrPhp;

@end

@implementation FourGViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self makeBaseUI];
    self.view.backgroundColor = [UIColor getColorFromRGBString:@"#D53C50"];
    // Do any additional setup after loading the view.
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}
- (void)makeBaseUI{
    [self.view addSubview:self.myTableView];
     self.marr  = @[@"我的积分",@"我的消息",@"我的红包",@"我的贴吧",@"我的视频",@"我的账号",@"联系客服",@"关于我们"].mutableCopy;
    self.marrPhp = @[@"q8",@"q3",@"q4",@"q5",@"q",@"q6",@"q2",@"q1"].mutableCopy;
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return 120;
    }
    return CGFLOAT_MIN;

}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    if (section == 0){
    UIView *scrBackView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ZTY_SCREEN_WIDTH, 120)];
    UIView *HendView= [[UIView alloc]initWithFrame:CGRectMake(ZTY_SCREEN_WIDTH/2-40, 5, 80, 80)];
        UIImageView *Vimage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 80, 80)];
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(ZTY_SCREEN_WIDTH/2-40, 90, 80, 25)];
        label.text = @"我是煎饼";
        label.textColor = [UIColor whiteColor];
        label.adjustsFontSizeToFitWidth =YES;
        label.textAlignment = NSTextAlignmentCenter;
        Vimage.image=[UIImage imageNamed:@"3.png"];
        scrBackView.backgroundColor = [UIColor getColorFromRGBString:@"#D53C50"];
        HendView.layer.cornerRadius=HendView.frame.size.width/2;//裁成圆角
        HendView.layer.masksToBounds=YES;//隐藏裁剪掉的部分
        HendView.layer.borderWidth = 1.5f;//宽度
        HendView.layer.borderColor = [UIColor whiteColor].CGColor;//颜色
        [HendView addSubview:Vimage];
    [scrBackView addSubview:HendView];
        [scrBackView addSubview:label];
    return scrBackView;
    
    }
    return nil;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 1;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    
    return nil;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.marr.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 55;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    FourTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    //    for(id temp in cell.contentView.subviews)
    //    {
    //        [temp removeFromSuperview];
    //    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (!cell) {
        cell = [[FourTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.isFormFirst = YES;
        cell.labelName.text= self.marr[indexPath.section];
        cell.imageView_photo.image = [UIImage imageNamed:self.marrPhp[indexPath.section]];
    }
    cell.textLabel.font = [UIFont systemFontOfSize:16];
    cell.detailTextLabel.text = @"1234";
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section==0) {
        FJFViewController *vc = [[FJFViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
        
    }else if (indexPath.section==1){
        FXXViewController *vc= [[FXXViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.section==2){
        FHBViewController *vc=[[FHBViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.section==3){
        FTBViewController *vc=[[FTBViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
        
    }else if (indexPath.section==4){
        FSPViewController *vc=[[FSPViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.section==5){
        FZHViewController *vc=[[FZHViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.section==6){
        FKFViewController *vc=[[FKFViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.section==7){
        FWMViewController *vc = [[FWMViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }
}

- (UITableView *)myTableView{
    
    if (_myTableView == nil) {
        _myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 20, ZTY_SCREEN_WIDTH, ZTY_SCREEN_HEIGHT-49) style:UITableViewStyleGrouped];
        _myTableView.dataSource = self;
        _myTableView.delegate = self;
        _myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        
    }
    
    return _myTableView;
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
